Skip to content

FINERACT-2293: Migrate client address module to new command pipeline#5657

Open
avivijay19 wants to merge 1 commit intoapache:developfrom
avivijay19:FINERACT-2293
Open

FINERACT-2293: Migrate client address module to new command pipeline#5657
avivijay19 wants to merge 1 commit intoapache:developfrom
avivijay19:FINERACT-2293

Conversation

@avivijay19
Copy link
Contributor

Description

Describe the changes made and why they were made. (Ignore if these details are present on the associated Apache Fineract JIRA ticket.)

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per our guidelines
  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow our coding conventions.
  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.

Your assigned reviewer(s) will follow our guidelines for code reviews.

@avivijay19 avivijay19 force-pushed the FINERACT-2293 branch 2 times, most recently from 602cd1a to 91c3b39 Compare March 22, 2026 18:36
public interface ClientAddressWriteService {

CommandProcessingResult addClientAddress(Long clientId, Long addressTypeId, JsonCommand command);
ClientAddressCreateResponse createClientAddress(ClientAddressCreateRequest request);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between createClientAddress and addNewClientAddress? Only difference I see is in one you pass an client ID, in the other the whole client object? On the surface looks like this is doing the samem? can we eliminate one?

}

@Override
public void addNewClientAddress(Client client, List<ClientAddressCreateRequest> requests) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this loop inside this service? I bet this is called only in 1 place... let's create the loop there... no added value hiding 3 lines of code in a service and they add basically no new functionality. We are not saving anything here... unless you tell me we are calling this function in 57 places...

}
}

private Address createAddressFromRequest(ClientAddressCreateRequest request) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can move to createClientAddres function once we have remove that other one with the loop.

import org.springframework.jdbc.core.JdbcTemplate;

@Configuration
public class AddressConfiguration {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClientAddressConfiguration.... consistency...


@Path("/v1/client")
@Component
@Tag(name = "Clients Address", description = "Address module is an optional module and can be configured into the system by using GlobalConfiguration setting: enable-address. In order to activate Address module, we need to enable the configuration, enable-address by setting its value to true.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description is maybe better in triple quotes aka multi-line strings. This here won't pass the Linter (aka Spotless plugin), whereas a multi-line string allows you to make this readable for everyone and the linter won't touch it.

@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Retrieve client address template", operationId = "retrieveTemplateClientAddress")
public AddressData getAddressesTemplate() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClientAddressData... consistency

@@ -23,7 +23,7 @@
import java.util.HashMap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As soon as we read "XXXSwagger.java" something is wrong aka not finished. Again, these are the dummy classes we intend to remove... mentioned it already a couple of times... maybe go slower with the changes and double check yourself before you submit.


if (isAddressEnabled) {
this.addressWritePlatformService.addNewClientAddress(newClient, command);
final com.google.gson.JsonArray addressArray = command.arrayOfParameterNamed("address");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not type safety! This kind of thing is now consistently slipping through the cracks. ANYTHING:

  • GSON
  • xxxParamterNamed
  • JsonArray
  • JsonXXX
  • JsonCommand
  • CommandWrapper
  • CommandBuilder

... needs to go, because this is the goal of this exercise, to make things type safe... all of the above is not. Again, maybe go a bit slower... otherwise this feels a bit like a prompt loop. I don't mind reviewing... but let's keep an eye on these details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants